<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #container{
            width: 700px;
            height: 1000px;
            margin: auto;
        }
        .add,.minus,.mul,.division{
            display: inline-block;
            background-color: white;
            width: 110px;
            height: 80px;
            line-height: 80px;
            margin-right: 30px;
            text-align: center;
            border-radius: 5px;
            border: 0px solid white;
        }
        .add{
            margin-left: 30px;
        }
        .body{
            background: #536595;
            width: 620px;
            height: 500px;
            font-size: 20px;
            padding-top: 28px;
            margin: auto;
        }
        .top{
            font-size: 30px;
            font-weight: bold;
            text-align: center;
            margin-bottom: 30px;
        }
        span{
            color: white;
            margin-left: 30px;
            margin-right: 30px;
        }
        .text{
            width: 160px;
            display: inline-block;
            text-align: center;
        }
        div{
            margin-top: 15px;
            margin-bottom: 30px;
        }

        input{
            width: 400px;
            height: 35px;
            border-radius: 5px;
            border: 1px solid white;
            font-size: 20px;
        }
    </style>
    <script>
        function calc(flag){
            //获取DOM对象
            var one=document.getElementById("one");
            var two=document.getElementById("two");
            var result=document.getElementById("result");
            var resultValue;
            if(flag=="+"){
                resultValue=one.value*1+two.value*1;
            }else if(flag=="-"){
                resultValue=one.value*1-two.value*1;
            }else if(flag=="*"){
                resultValue=one.value*1*two.value*1;
            }else{
                resultValue=one.value*1/two.value*1;
            }
            result.value=resultValue;
        }
    </script>
</head>
<body>
<div id="container">
    <div class="top">
        计算器
    </div>
    <div class="body">
        <div class="firstNum">
            <div class="text">
                <span>第一个数：</span>
            </div>
            <input type="text" id="one">
        </div>
        <div class="secondNum">
            <div class="text">
                <span>第二个数：</span>
            </div>
            <input type="text" id="two">
        </div>
        <div>
            <div class="add" onclick="calc('+')">+</div>
            <div class="minus" onclick="calc('-')">-</div>
            <div class="mul" onclick="calc('*')">*</div>
            <div class="division" onclick="calc('/')">/</div>
        </div>
        <div class="result">
            <div class="text">
                <span>结果：</span>
            </div>
            <input type="text" id="result">
        </div>
    </div>
</div>
</body>
</html>